![]() |
LockPixels |
||||
Header: | QDOffscreen.h | Carbon status: | Supported | |
Prevents the base address for an offscreen pixel image from being moved while you draw into or copy from its pixel map.
Boolean LockPixels ( PixMapHandle pm );
A handle to an offscreen pixel map. To get a handle to an offscreen pixel map, use the GetGWorldPixMap function .
If the base address for an offscreen pixel image hasn’t been purged by the Memory Manager or is not purgeable, LockPixels returns TRUE as its function result, and your application can draw into or copy from the offscreen pixel map. However, if the base address for an offscreen pixel image has been purged, LockPixels returns FALSE to indicate that you can perform no drawing to or copying from the pixel map. At that point, your application should either call the UpdateGWorld function to reallocate the offscreen pixel image and then reconstruct it, or draw directly in a window instead of preparing the image in an offscreen graphics world.
You must call LockPixels before drawing to or copying from an offscreen graphics world.
The baseAddr field of the PixMap structure for an offscreen graphics world contains a handle instead of a pointer (which is what the baseAddr field for an onscreen pixel map contains). The LockPixels function dereferences the PixMap handle into a pointer. When you use the UnlockPixels function the handle is recovered.
As soon as you are finished drawing into and copying from the offscreen pixel image, call the UnlockPixels function.
The LockPixels function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)